use crate::core::traits::Dot;
use crate::vector::items::Items;

impl Dot<f64> for Items<f64> {
    //点乘，向量other在本向量的投影
    fn dot(&self, other: Self) -> f64 {
        assert_eq!(self.len(), other.len());

        self.0
            .iter()
            .zip(other.0.iter())
            .map(|(&x, &y)| x * y)
            .sum()
    }
}
